<template>
    <div class="teacher">
        <h3>教师姓名：{{ teacher.name }}</h3>
        <h3>教师性别：{{ teacher.sex }}</h3>
        <h3>教师年龄：{{ teacher.age }}</h3>
        <button @click="submit">发送教师姓名</button>
        <button @click="submitToStu">发送教师姓名</button>
        <h3>{{ degree }}</h3>
    </div>

</template>


<script setup>
import { reactive,inject } from 'vue';
import Teacher from '../../6.4computed/components/Teacher.vue';

const teacher=reactive({
    name:'李教师',
    age:30,
    sex:' 女'
})
const degree=inject('degree')
const emits=defineEmits(['get-tname'])

const $bus=inject('$bus')
function submitToStu(){
    $bus.emit('setTname',teacher.name)
    console.log('000');
    
}

function submit(){
    emits('get-tname',teacher.name)
}

</script>